import JSEncrypt from 'jsencrypt'

/**
 * 公钥
 * @type {string}
 */
const rsa_public = `
        -----BEGIN PUBLIC KEY-----
        MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUME/hOh3I+xzEe0sCdxDM7IGw
        rFMH3rJ0kVz/dYiVsSNh/FOYDuBons+/xVd6bKLTdAWncyYANqP20fwS5E5NhsdR
        YsJBRDUwidn5lGaHjtLTAozwozpqcsJR/3wj7E7XLLtIKJZ/t+cTxQJ3nPF+ENAG
        oYB0p10kGm9Ph32ydQIDAQAB
        -----END PUBLIC KEY-----`

export function encryption(str) {
  const encrypt = new JSEncrypt ();
  encrypt.setPublicKey (rsa_public);
  return encrypt.encrypt (str);
}
